package com.linghang.back.repository;

import com.linghang.back.entity.Article;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface ArticleRepository extends JpaRepository<Article, Long> {
    
    /**
     * 根据微信文章ID查找文章
     */
    Optional<Article> findByWechatArticleId(String wechatArticleId);
    
    /**
     * 按类型和分页条件查询文章
     */
    Page<Article> findByType(String type, Pageable pageable);
    
    /**
     * 根据标题模糊搜索文章
     */
    Page<Article> findByTitleContaining(String keyword, Pageable pageable);
} 